<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/24 0024
  Time: 下午 4:37
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<style>
    .box-padding-15{
        padding: 15px;
    }
    .layui-breadcrumb a{
        font-size: 20px;
    }
</style>
<html>
<head>
    <title>添加会员类型</title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">
</head>
<body>

<div class="box-padding-15">
    <span class="layui-breadcrumb">
          <a href="#">首页</a>
          <a href="javascript:;">门店信息管理</a>
          <a><cite>添加</cite></a>
        </span>
    <hr>
    <div class="layui-container box-form">
        <form class="layui-form " action="/dept/save" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">店面编号</label>
                <div class="layui-input-block">
                    <input type="text" name="deptId" required  lay-verify="required|deptId" placeholder="请输入店面编号" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">店面名称</label>
                <div class="layui-input-block">
                    <input type="text" name="deptName" required  lay-verify="required|deptName" placeholder="请输入店名" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">店面固话</label>
                <div class="layui-input-block">
                    <input type="text" name="deptPhone" required  lay-verify="required|deptPhone" placeholder="请输入店面固话" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">店长姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="ownerName" required  lay-verify="required|ownerName" placeholder="请输入店长姓名" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">店长电话</label>
                <div class="layui-input-block">
                    <input type="text" name="ownerMobile" required  lay-verify="required|ownerMobile" placeholder="请输入店长电话" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">所在城市</label>
                <div class="layui-input-block">
                    <input type="text" name="inCity" required  lay-verify="required|inCity" placeholder="请输入所在城市" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">详细地址</label>
                <div class="layui-input-block">
                    <input type="text" name="address" required  lay-verify="required|address" placeholder="请输入详细地址" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">经度</label>
                <div class="layui-input-block">
                    <input type="text" name="gpslon" required  lay-verify="required|gpslon" placeholder="请输入经度" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">纬度</label>
                <div class="layui-input-block">
                    <input type="text" name="gpslat" required  lay-verify="required|gpslat" placeholder="请输入纬度" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">详细描述</label>
                <div class="layui-input-block">
                    <input type="text" name="remark" required  lay-verify="required|remark" placeholder="请输入详细描述" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
                    <a href="/dept"><button type="button" class="layui-btn layui-btn-primary">取消</button></a>
                </div>
            </div>
        </form>
    </div>
</div>


<script src="/static/plugins/jquery.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script src="/static/js/common.js"></script>
<script>

    layui.use(['element','layer','form'], function(){
        var form = layui.form;
        var layer = layui.layer;
        //监听提交、异步保存
         form.on('submit(formSubmit)', function(data){
             $.ajax({
                 url:"/dept/save",
                 type:"post",
                 data:data.field,
                 dataType:'json',
                 success:function (rs) {
                     debugger
                     layer.msg(rs.message,{time:1000},function () {
                         if(rs.code == 1) {
                             location.href = "/dept"
                             //layer.msg("保存成功",{
                             /*parent.$("#tb_page").bootstrapTable("refresh");  //刷新表格数据
                             var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                             parent.layer.close(index); //再执行关闭*/

                         }
                     });
                 },
                 error:function () {
                     layer.msg("服务器忙，请稍候再试")
                 }
             });
             return false;
        });
    });
</script>
</body>
</html>
